//
//  MainMenuScene.m
//  ShoutBoss
//
//  Created by Luck Mstone on 6/15/09.
//  Copyright 2009 MS. All rights reserved.
//

#import "MainMenuScene.h"
#import "MainMenuBackGround.h"
#import "BossBodyScene.h"
#import "HelpScene.h"
#import "SettingScene.h"

@implementation MainMenuScene

-(id) init
{
	self = [super init];
	if(self != nil){
		//MainMenuScene 初始化工作
		//背景精灵
		CGSize s = [[Director sharedDirector] winSize];
		MainMenuBackGround* background = [MainMenuBackGround node];
		[self addChild:background];
		[background setPosition: ccp(s.width/2, s.height/2)];
		
		//主要菜单选项
		MenuItem *menuItem1 = [MenuItemFont itemFromString:@"Resume Game" target:self selector:@selector(onResumeGame:)];
		MenuItem *menuItem2 = [MenuItemFont itemFromString:@"New Game" target:self selector:@selector(onNewGame:)];
		MenuItem *menuItem3 = [MenuItemFont itemFromString:@"Settings" target:self selector:@selector(onSettings:)];
		MenuItem *menuItem4 = [MenuItemFont itemFromString:@"Help" target:self selector:@selector(onHelp:)];
		
		Menu *menu = [Menu menuWithItems:menuItem1, menuItem2, menuItem3, menuItem4, nil];
		[menu alignItemsVertically];
		
		[self addChild:menu];
	}
	
	return self;
}

//恢复游戏
-(void)onResumeGame:(id)sender
{
	
}

//开始新游戏
-(void)onNewGame:(id)sender
{
	// 切换到BossBody
	BossBodyScene* bossBodyScene = [BossBodyScene node];
	[[Director sharedDirector] replaceScene:bossBodyScene];
}

//Setting界面
-(void)onSettings:(id)sender
{
	// 切换到Setting
	SettingScene* bossBodyScene = [SettingScene node];
	[[Director sharedDirector] replaceScene:bossBodyScene];
}

//Help界面
-(void)onHelp:(id)sender
{
	// 切换到Help
	HelpScene* bossBodyScene = [HelpScene node];
	[[Director sharedDirector] replaceScene:bossBodyScene];
}

@end
